#pragma once
#include "../Ode.h"

namespace Skill
{
	namespace Ode
	{
		ref class DVector3;
		ref class DVector4;
		ref class DQuaternion;
		ref class DMatrix3;
		ref class DMatrix4;

		public ref class DRandom abstract sealed
		{
		public:
			/// <summary>
			/// return 1 if the random number generator is working.
			/// </summary>
			static bool TestRand();

			/// <summary>
			/// return next 32 bit random number. this uses a not-very-random linear
			/// congruential method.
			/// </summary>
			static unsigned long GetRandom();

			/// <summary>
			/// get and set the current random number seed.
			/// </summary>
			static VALUE_PROP_DECLARATION_GETSET(unsigned long,Seed);			

			/// <summary>
			/// return a random integer between 0..n-1. the distribution will get worse
			/// as n approaches 2^32.
			/// </summary>
			static int GetRandInt(int n);

			/// <summary>
			/// return a random real number between 0..1
			/// </summary>
			static dReal GetRandReal();			

			/// <summary>
			/// make a random vector with entries between +/- range.
			/// </summary>
			static void MakeRandomVector(DVector3^ A, dReal range);

			/// <summary>
			/// make a random vector with entries between +/- range.
			/// </summary>
			static void MakeRandomVector(DVector4^ A, dReal range);

			/// <summary>
			/// make a random quaternion with entries between +/- range.
			/// </summary>
			static void MakeRandomQuaternion(DQuaternion^ A, dReal range);

			/// <summary>
			/// make a random matrix with entries between +/- range.
			/// </summary>
			static void MakeRandomMatrix(DMatrix3^ A, dReal range);

			/// <summary>
			/// make a random matrix with entries between +/- range.
			/// </summary>
			static void MakeRandomMatrix(DMatrix4^ A, dReal range);			

			/// <summary>
			/// clear the upper triangle of a square matrix
			/// </summary>
			static void ClearUpperTriangle(DMatrix4^ A);

			/// <summary>
			/// return the maximum element difference between the two matrices
			/// </summary>
			static dReal GetMaxDifference(DMatrix4^ A, DMatrix4^ B);

			/// <summary>
			/// return the maximum element difference between the two matrices
			/// </summary>
			static dReal GetMaxDifference(DMatrix3^ A, DMatrix3^ B);

			/// <summary>
			/// return the maximum element difference between the lower triangle of two			
			/// </summary>
			static dReal GetMaxDifferenceLowerTriangle(DMatrix4^ A, DMatrix4^ B);
		};
	}
}